package com.hq.user.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hq.user.entity.SysRole;
import com.hq.user.service.SysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author Administrator
 */
@RestController
@RequestMapping("/sysRole")
public class SysRoleController {
    @Autowired
    private SysRoleService sysRoleService;
    @GetMapping
    public Object getPage(Page page, SysRole sysRole) {
        return sysRoleService.page(page, Wrappers.query(sysRole));
    }

    @GetMapping("/{id}")
    public Object getById(@PathVariable String id) {
        return sysRoleService.getById(id);
    }

    @PostMapping
    public Object Save(@RequestBody SysRole sysRole) {
        return sysRoleService.save(sysRole);
    }

    @PutMapping
    public Object update(@RequestBody SysRole sysRole) {
        return sysRoleService.updateById(sysRole);
    }

    @DeleteMapping("/{id}")
    public Object testSave(@PathVariable String id) {
        return sysRoleService.removeById(id);
    }
}
